KProjectExtension{ }
init{
  kBaseURLs=new HashMap<String,String>();
  kProjects=new HashMap<String,KProject>();
  kBases=new HashMap<String,org.drools.kproject.KBase>();
  kSessions=new HashMap<String,org.drools.kproject.KSession>();
}
processInjectionTarget{
  if (kProjects == null) {
  if (!pit.getInjectionTarget().getInjectionPoints().isEmpty()) {
    for (    InjectionPoint ip : pit.getInjectionTarget().getInjectionPoints()) {
      KBase kBase=ip.getAnnotated().getAnnotation(KBase.class);
      if (kBase != null) {
        if (kBaseQNames == null) {
          kBaseQNames=new HashSet<String>();
        kBaseQNames.add(kBase.value());
      KSession kSession=ip.getAnnotated().getAnnotation(KSession.class);
      if (kSession != null) {
        if (kSessionQNames == null) {
          kSessionQNames=new HashSet<String>();
        kSessionQNames.add(kSession.value());
}
afterBeanDiscovery{
  if (kProjects != null) {
    Map<String,KBaseBean> kBaseBeans=new HashMap<String,KProjectExtension.KBaseBean>();
        KBaseBean bean=new KBaseBean(kBases.get(kBaseQName),kBaseURLs.get(kBaseQName),kBaseBeans);
        kBaseBeans.put(kBaseQName,bean);
        abd.addBean(bean);
    if (kSessionQNames != null) {
      for (      String kSessionQName : kSessionQNames) {
        org.drools.kproject.KSession kSession=kSessions.get(kSessionQName);
        KBaseBean bean=kBaseBeans.get(((KSessionImpl)kSession).getKBase().getQName());
        if ("stateless".equals(kSession.getType())) {
          abd.addBean(new StatelessKSessionBean(kSession,bean));
          abd.addBean(new StatefulKSessionBean(kSession,bean));
    kSessionQNames=null;
    kProjects=null;
    kSessions=null;
}
KBaseBean{
  this.kBaseBeans=kBaseBeans;
  this.qualifiers=Collections.unmodifiableSet(new HashSet<Annotation>(Arrays.asList(new AnnotationLiteral<Default>(){
,new AnnotationLiteral<Any>(){
    public Class<? extends Annotation> annotationType(){
      return kBaseModel.getQName();
}
annotationType{
  return KBase.class;
}
value{
  return kBaseModel.getQName();
}
create{
  KnowledgeBuilder kbuilder=KnowledgeBuilderFactory.newKnowledgeBuilder();
  CompositeKnowledgeBuilder ckbuilder=kbuilder.batch();
  Set<String> includes=kBaseModel.getIncludes();
  if (includes != null && !includes.isEmpty()) {
    for (    String include : includes) {
      KBaseBean includeBean=kBaseBeans.get(include);
      addFiles(ckbuilder,includeBean.getkBaseModel(),includeBean.getUrlPath());
  addFiles(ckbuilder,kBaseModel,urlPath);
  ckbuilder.build();
}
addFiles{
  List<String> files=modelToAdd.getFiles();
  String rootPath=urlPathToAdd;
  if (rootPath.lastIndexOf(':') > 0) {
    rootPath=urlPathToAdd.substring(rootPath.lastIndexOf(':') + 1);
  if (urlPathToAdd.endsWith(".jar")) {
    File actualZipFile=new File(rootPath);
    if (!actualZipFile.exists()) {
    ZipFile zipFile=null;
    try {
      zipFile=new ZipFile(actualZipFile);
 catch (    Exception e) {
    try {
      for (      String file : files) {
        ZipEntry zipEntry=zipFile.getEntry(file);
        ckbuilder.add(ResourceFactory.newInputStreamResource(zipFile.getInputStream(zipEntry)),ResourceType.DRL);
 catch (    Exception e) {
      try {
 catch (      IOException e1) {
    try {
      for (      String file : files) {
        ckbuilder.add(ResourceFactory.newFileResource(new File(rootPath,file)),ResourceType.DRL);
 catch (    Exception e) {
}
getkBaseModel{ }
getUrlPath{ }
getKnowledgeBase{ }
destroy{
  this.kBase=null;
}
getBeanClass{
  return KnowledgeBase.class;
}
getInjectionPoints{
  return Collections.emptySet();
}
getName{ }
getQualifiers{
  return qualifiers;
}
getScope{
  return ApplicationScoped.class;
}
getStereotypes{
  return Collections.emptySet();
}
getTypes{ }
isAlternative{ }
isNullable{ }
StatelessKSessionBean{
  this.kSessionModel=kSessionModel;
  this.kBaseModel=((KSessionImpl)kSessionModel).getKBase();
  this.qualifiers=Collections.unmodifiableSet(new HashSet<Annotation>(Arrays.asList(new AnnotationLiteral<Default>(){
    public Class<? extends Annotation> annotationType(){
      return kSessionModel.getQName();
}
annotationType{
  return KSession.class;
}
value{
  return kSessionModel.getQName();
}
create{
  KnowledgeBase kBase=kBaseBean.getKnowledgeBase();
  return kBase.newStatelessKnowledgeSession();
}
destroy{
  ctx.release();
}
getBeanClass{
  return StatelessKnowledgeSession.class;
}
getInjectionPoints{
  return Collections.emptySet();
}
getName{ }
getQualifiers{
  return qualifiers;
}
getScope{
  return ApplicationScoped.class;
}
getStereotypes{
  return Collections.emptySet();
}
getTypes{ }
isAlternative{ }
isNullable{ }
StatefulKSessionBean{
  this.kSessionModel=kSessionModel;
  this.kBaseModel=((KSessionImpl)kSessionModel).getKBase();
  this.qualifiers=Collections.unmodifiableSet(new HashSet<Annotation>(Arrays.asList(new AnnotationLiteral<Default>(){
    public Class<? extends Annotation> annotationType(){
      return kSessionModel.getQName();
}
annotationType{
  return KSession.class;
}
value{
  return kSessionModel.getQName();
}
create{
  KnowledgeBase kBase=kBaseBean.getKnowledgeBase();
  return kBase.newStatefulKnowledgeSession();
}
destroy{
  ctx.release();
}
getBeanClass{
  return StatefulKnowledgeSession.class;
}
getInjectionPoints{
  return Collections.emptySet();
}
getName{ }
getQualifiers{
  return qualifiers;
}
getScope{
  return ApplicationScoped.class;
}
getStereotypes{
  return Collections.emptySet();
}
getTypes{ }
isAlternative{ }
isNullable{ }
buildKProjects{
  ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
  final Enumeration<URL> e;
  try {
  Map<String,String> urls=new HashMap<String,String>();
  while (e.hasMoreElements()) {
    URL url=e.nextElement();
    try {
      XStream xstream=new XStream();
      KProject kProject=(KProject)xstream.fromXML(url);
      String kProjectId=kProject.getGroupArtifactVersion().getGroupId() + ":" + kProject.getGroupArtifactVersion().getArtifactId();
      urls.put(kProjectId,fixURL(url));
      kProjects.put(kProjectId,kProject);
 catch (    Exception exc) {
  for (  KProject kProject : kProjects.values()) {
    for (    org.drools.kproject.KBase kBase : kProject.getKBases().values()) {
      kBases.put(kBase.getQName(),kBase);
      String kProjectId=kProject.getGroupArtifactVersion().getGroupId() + ":" + kProject.getGroupArtifactVersion().getArtifactId();
      kBaseURLs.put(kBase.getQName(),urls.get(kProjectId));
      for (      org.drools.kproject.KSession kSession : kBase.getKSessions().values()) {
        ((KSessionImpl)kSession).setKBase(kBase);
        kSessions.put(kSession.getQName(),kSession);
}
fixURL{
  String urlPath=url.toExternalForm();
  String urlType="file";
  int colonIndex=urlPath.indexOf(":");
    urlType=urlPath.substring(0,colonIndex);
  urlPath=url.getPath();
  if ("jar".equals(urlType)) {
    if (urlPath.indexOf('!') > 0) {
      urlPath=urlPath.substring(0,urlPath.indexOf('!'));
 else {
  colonIndex=urlPath.lastIndexOf(":");
    urlPath=urlPath.substring(colonIndex + 1);
  try {
    urlPath=URLDecoder.decode(urlPath,"UTF-8");
 catch (  UnsupportedEncodingException ex) {
  return urlPath;
}
